Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] use model_class to unify module init #2216

Merged
merged 9 commits into from
Dec 10, 2023
Merged

Conversation

xingchensong
Copy link
Member

@xingchensong xingchensong commented Dec 8, 2023

  • 简化 init_model.py, 方便未来增加新的模型,建设过多if-else特判
  • 单元测试,针对所有train config,都进行是否可以成功初始化的检测
def test_init_model():
    configs = glob.glob("examples/*/*/conf/*.yaml")
    args = DummyArguments()
    for c in configs:
        with open(c, 'r') as fin:
            config = yaml.load(fin, Loader=yaml.FullLoader)
        if 'fbank_conf' in config['dataset_conf']:
            input_dim = config['dataset_conf']['fbank_conf']['num_mel_bins']
        elif 'log_mel_spectrogram_conf' in config['dataset_conf']:
            input_dim = config['dataset_conf']['log_mel_spectrogram_conf'][
                'num_mel_bins']
        else:
            input_dim = config['dataset_conf']['mfcc_conf']['num_mel_bins']
        config['input_dim'] = input_dim
        # TODO(xcsong): fix vocab_size
        config['output_dim'] = 3000
        print("checking {} {}".format(c, config))
        init_model(args, config)

@xingchensong xingchensong marked this pull request as ready for review December 10, 2023 12:20
@robin1001 robin1001 merged commit d2b337d into main Dec 10, 2023
6 checks passed
@robin1001 robin1001 deleted the xcsong-refactor-unify branch December 10, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants